package auctiongui;


import auctioncentral.AuctionSystem;
import auctioncentral.Bid;
import auctioncentral.Item;
//import java.util.ArrayList;
import java.util.List;
import javax.swing.table.AbstractTableModel;

public class BidTableModel extends AbstractTableModel {

    private List<Bid> my_bid_list;
    private String[] columnNames = {"Item Name", "Auction Name and Date", "Amount of Bid"};
    private AuctionSystem my_as;

    public BidTableModel(List<Bid> the_bid_list, AuctionSystem as){
         my_bid_list = the_bid_list;
         my_as = as;
    }

    @Override
    public String getColumnName(int the_column_index){
         return columnNames[the_column_index];
    }

    @Override     
    public int getRowCount() {
    	
    	
        return my_bid_list.size();
    }

    @Override        
    public int getColumnCount() {
        return 3; 
    }

    @Override
    public Object getValueAt(int the_row_index, int the_column_index) {
        Bid si = my_bid_list.get(the_row_index);
        
        switch (the_column_index) {
            case 0: 
                return my_as.findItemByID(si.getItemId()).getMy_name();
            case 1:
            	//return "Not Working Yet";
                return my_as.findEventFromBid(si);
            case 2:
                return si.getAmount();
           }
           return null;
   }

   @Override
   public Class<?> getColumnClass(int the_column_index){
	   		return String.class;
      }
 }